From b0aa228b984588c97331f985a39d7006dfd13bdb Mon Sep 17 00:00:00 2001 From: robertl Date: Mon, 19 Jan 2004 18:11:47 +0000 Subject: [PATCH] Remove bad interactions of duped waypoints when those waypoints appear on a queue. --- gpsbabel/mapsource.c | 5 ----- gpsbabel/waypt.c | 6 ++++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/gpsbabel/mapsource.c b/gpsbabel/mapsource.c index d898f6c5d..0dcbcf102 100644 --- a/gpsbabel/mapsource.c +++ b/gpsbabel/mapsource.c @@ -125,7 +125,6 @@ void mps_wpt_q_add(const queue *whichQueue, const waypoint *wpt) { waypoint *written_wpt = waypt_dupe(wpt); - written_wpt->Q.next = written_wpt->Q.prev = NULL; ENQUEUE_TAIL(whichQueue, &written_wpt->Q); } @@ -809,7 +808,6 @@ mps_waypoint_w_uniqloc_wrapper(waypoint *wpt) /* Not the same lat lon, so rename and add */ newName = mkshort(written_wpt_mkshort_handle, wpt->shortname); wptfound = waypt_dupe(wpt); - wptfound->Q.next = wptfound->Q.prev = NULL; xfree(wptfound->shortname); wptfound->shortname = newName; mps_waypoint_w(mps_file_out, mps_ver_out, wptfound, (1==0)); @@ -955,14 +953,12 @@ mps_route_r(FILE *mps_file, int mps_ver, route_head **rte) if (tempWpt != NULL) { thisWaypoint = waypt_dupe(tempWpt); - thisWaypoint->Q.next = thisWaypoint->Q.prev = NULL; } else { tempWpt = mps_find_wpt_q_by_name(&read_route_wpt_head, wptname); if (tempWpt != NULL) { thisWaypoint = waypt_dupe(tempWpt); - thisWaypoint->Q.next = thisWaypoint->Q.prev = NULL; } else { /* should never reach here, but we do need a fallback position */ @@ -1061,7 +1057,6 @@ mps_route_r(FILE *mps_file, int mps_ver, route_head **rte) if (tempWpt != NULL) { thisWaypoint = waypt_dupe(tempWpt); - thisWaypoint->Q.next = thisWaypoint->Q.prev = NULL; } else { thisWaypoint = waypt_new(); diff --git a/gpsbabel/waypt.c b/gpsbabel/waypt.c index a62a44d8a..32710c729 100644 --- a/gpsbabel/waypt.c +++ b/gpsbabel/waypt.c @@ -50,6 +50,12 @@ waypt_dupe(const waypoint *wpt) tmp->url = xstrdup(wpt->url); if (wpt->url_link_text) tmp->url_link_text = xstrdup(wpt->url_link_text); + /* + * It's important that this duplicated waypoint not appear + * on the master Q. + */ + tmp->Q.next = tmp->Q.prev = NULL; + tmp->gpx_extras = NULL; return tmp; } -- 2.30.2